#ifndef __SERVEUTILS_H__
#define __SERVEUTILS_H__
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <arpa/inet.h>


//int errexit(const char* format, ...);

/**
* passivesock - allocate & bind a server socket using TCP or UDP
\param service Service associated with the desired port.
\param transport Transport protocol to use ("tcp" or "udp").
\param qlen Maximum server request queue length.
*/
int passivesock(const char* service,const char* transport,int qlen);


/**
* passiveUDP - Create a passive socket for use in a UDP server
\param service Service associated with the desired port.
*/
int passiveUDP(const char* service,int qlen);


/**
* passiveTCP - Create a passive socket for use in a TCP server
\param service Service associated with the desired port.
*/
int passiveTCP(const char* service,int qlen );

int socketInit(const char* service,const char* transport,int qlen,unsigned int port);

int socketInitUDP(const char* service,int qlen,unsigned int port);

int socketInitTCP(const char* service,int qlen,unsigned int port);

int connectSocket(const char* ip,const char*  transport ,unsigned int port);

#endif // __SERVEUTILS_H__
